(*
 *
 *)

module type SigHeap =
        sig
                exception KNE
                type ('a,'b) t 
                
                val createh: unit-> (string,'b) t
                val addh: string -> (string,'b) t -> unit
                val isindomh: string -> (string,'b) t -> bool
                val valinh: string -> (string, 'b) t -> 'b MyQueue.t
                val update: string -> 'b MyQueue.t -> (string, 'b) t -> unit
                val heap2list: (string, 'b) t -> (string * 'b MyQueue.t) list
                (* val remove : 'a -> ('a, 'b) t -> unit *)
        end


module Heap(MyMap: SigMap) : SigHeap =
        struct
                exception KNE
                type ('a,'b) t = ('a, ('b MyQueue.t)) MyMap.t ref

                (* type ('a, 'b) t = ('a, 'b) MyMap.t ref *)

                let createh () = ref MyMap.createmap

                let addh ch m = m := MyMap.addmap (ch, MyQueue.createq ()) !m

                let isindomh ch m = MyMap.isinmap ch !m

                let valinh ch m = MyMap.lookupmap ch !m

                let update ch q m = m := MyMap.updatemap (ch,q) !m

                let heap2list m = MyMap.map2list !m

        end
                
